#!/usr/bin/python3
# coding=utf-8

from flask import Flask, request, jsonify
from flask import Flask
import json
from flask_cors import CORS, cross_origin
app = Flask(__name__)
app.debug = True
from data import data

@app.route('/ReadingAssist/special/getTopicInfo', methods=['post', 'get'])
@cross_origin()
def post_http():

    ret = {}
    ret['code'] = 200
    ret['data'] = {}
    ret['data']['keywords'] = [  "三顾茅庐",
                        "爱惜人才",
                        "诸葛亮",
                        "人才",
                        "刘备",
                        "支边",
                        "三顾",
                        "招聘",
                        "热情接待",
                        "用其所长",
                        "妥善安置",
                        "美谈",
                        "求贤若渴",
                        "出山",
                        "科技人员",
                        "好头",
                        "四化建设",
                        "阿克塞",
                        "礼贤下士",
                        "贯彻始终"]
    ret['message'] = 'success'
    # 把区获取到的数据转为JSON格式。
    return jsonify(ret)
    # 返回JSON数据。

@app.route('/EventExtract/assemble/getXGSResult', methods=['post', 'get'])
@cross_origin()
def post_http1():

    if 1:
        with open("data.json", "r", encoding="utf-8") as f:
            ret = json.loads(f.read())
    else:
        ret = {}
        ret['code'] = 200
        ret['data'] = {
            "total": 0,
            "data": []
        }
        ret['message'] = 'success'

    # 把区获取到的数据转为JSON格式。
    return jsonify(ret)
    # 返回JSON数据。

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8088)
    # 这里指定了地址和端口号。也可以不指定地址填0.0.0.0那么就会使用本机地址ip
